<?php
error_reporting(E_ALL);
set_time_limit(600);
$mem = new Memcache();
echo (int)$mem->connect('127.0.0.1', 11211);
echo "\n";
echo $mem->getVersion();
echo "\n";

$key = 'test_key';
$ttl = 3600;
//$storageType = MEMCACHE_COMPRESSED;        //MC压缩存储（ZLIB）
$storageType = 0;                   //MC非压缩存储

$mem->delete($key);

$val = require dirname(__FILE__). '/xxx_50.php';
//$mem->set($key, $val, $storageType, $ttl);               //数组存储形式
$mem->set($key, var_export($val, true), $storageType, $ttl);           //字符存储形式

$processtime = 0;
$processcount = 1;

echo "wait 10 sec\n";
sleep(10);


while($processcount <= 5000){
	$start = microtime(true);
	if(!$mem->get($key , $storageType)){
		$processcount++;
		echo "NO DATA FOUND";
		break;
	}
	$end = microtime(true);
	$processtime += ($end-$start);

	$processcount++;

}


echo 'PROCESS COUNT:'. ($processcount-1). '. PORCESS ALL TIME:'. $processtime. 's. EACH TIME:'. ($processtime/($processcount-1));